package br.edu.unifei.banded;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import br.edu.unifei.mestrado.commons.graph.RelationshipWrapper;
import br.edu.unifei.mestrado.commons.partition.AbstractSubSet;

public class SubSetBandedDiffusion extends AbstractSubSet {

	/**
	 * Somatorio dos pesos das arestas que estao no corte para este set.
	 */

	private int edgeCutWeight = 0;
	
	/**
	 * Lista das arestas que estao no corte para este set.
	 */
	private Map<Long, RelationshipWrapper> edgeCutList = new HashMap<Long, RelationshipWrapper>();
	
	public SubSetBandedDiffusion(int id) {
		super(id);
	}

	//TODO: verificar, pois tem outro código desse que faz if se a aresta já existe,
	//mas eu acho que é na partição inteira, no partition.
	//AbstractPartition
	public void addEdgeToCut(RelationshipWrapper edge) {
		edgeCutWeight += edge.getWeight();
		edgeCutList.put(edge.getId(), edge);
	}

	public void removeEdgeFromCut(RelationshipWrapper edge) {
		edgeCutWeight -= edge.getWeight();
		edgeCutList.remove(edge.getId());
	}

	public int getEdgeCutWeight() {
		return edgeCutWeight;
	}
	
	public Collection<RelationshipWrapper> getEdgeCutList() {
		return edgeCutList.values();
	}
	
}
